import { URI } from "@/services/api";
import { request, METHOD } from "@/utils/request";

export async function getData(code, type, pageSize, pageIndex) {
  return request(`${URI}/AgvPointMap/GetData`, METHOD.GET, {
    code, 
    type,
    pageSize,
    pageIndex,
  });
}

export async function save(model) {
  return request(`${URI}/AgvPointMap/Save`, METHOD.POST, {
    model: model,
  });
}

export async function detail(id) {
  return request(`${URI}/AgvPointMap/GetModel`, METHOD.GET, {
    id: id,
  });
}

export async function remove(id) {
  return request(`${URI}/AgvPointMap/Remove?id=` + id, METHOD.POST);
}

export async function batchAdd(list) {
  return request(`${URI}/AgvPointMap/BatchAdd`, METHOD.POST, {
    list: list,
  });
}

export async function batchDel(ids) {
  return request(`${URI}/AgvPointMap/BatchDel?ids=`+ids, METHOD.POST);
}

export async function getAll() {
  return request(`${URI}/AgvPointMap/GetAll`, METHOD.GET);
}


export async function getFrom() {
  return request(`${URI}/AgvPointMap/GetFrom`, METHOD.GET);
}

export default {
  getFrom,
  getData,
  save,
  detail,
  remove,
  batchAdd,
  batchDel,
  getAll
};
